<?php

class Master_upload_model extends arfaModel{

	function __construct()
	{
		parent::__construct();
		$this->table_name	= "master_upload";
		$this->primary_key	= "ID_UPLOAD";
		$this->order_by		= "ID_UPLOAD ASC"; 
	}
	
	function get_foto($id)
	{
		$query = $this->db->query("
			SELECT
			master_upload.ID_UPLOAD,
			master_upload.ID_RUAS,
			master_upload.CAPTION,
			master_upload.PATH_FOTO
			FROM master_upload
			WHERE master_upload.ID_RUAS = $id
		");
		
		return $query->result_array();
	}
	
	function get_paktif()
	{
		$query = $this->db->query("
			SELECT
			master_upload.ID_UPLOAD,
			master_upload.ID_RUAS,
			master_upload.CAPTION,
			master_upload.PATH_FOTO,
			ruas_jalan.ID_RUAS,
			ruas_jalan.ID_PERIODE,
			master_periode.ID_PERIODE,
			master_periode.STATUS_PERIODE
			FROM master_upload
			JOIN ruas_jalan ruas_jalan ON master_upload.ID_RUAS = ruas_jalan.ID_RUAS
			JOIN master_periode master_periode ON ruas_jalan.ID_PERIODE = master_periode.ID_PERIODE
			WHERE master_periode.STATUS_PERIODE = 1
		");
		
		return $query->result_array();
	}
}